<template>
	<view>
		<view class="container">
			<image class="bg" src="@/static/image/vipbg.png" mode="widthFix"></image>
			<view class="content">
				<swiper class="banner" circular @change="onSwiperChange" :current="current">
					<swiper-item v-for="(item,index) in vipList" :key="item.id">
						<image src="@/static/image/vipCard.png" mode="widthFix"></image>
						<view class="card">
							<view class="name">
								<image src="@/static/image/vipIcon1.png" mode=""></image> {{item.name}}
								<text class="currentGrade" v-if="item.selected == 1">Current Grade</text>
							</view>
							<view class="tips">
								{{item.remark}}
							</view>
						</view>
					</swiper-item>
				</swiper>
				<view class="title">
					VIP Benefits
				</view>
				<view class="Benefits">
					<view class="tips" v-if="!vip.award_show">
						 Go trade now ! ! ! ! ! !
						 <br />
						 upgrade to get more benefits 
					</view>
					<view class="item1" v-if="vip.award_show">
						Cash <text>{{vip.award_money}}{{vip.currency_unit}}</text>
					</view>
					<view class="item2" v-if="vip.award_show">
						<view class="Increase">
							<image src="@/static/image/vipIcon2.png" mode=""></image> Gift Card Rate Increase
						</view>
						<view class=" transaction">
							Any transaction
						</view>
						<view class="num">
							+{{vip.currency_unit}} <text>{{vip.award_exchange}}</text>/$
						</view>
						<view class="tips">
							{{vip.tips}}
						</view>
					</view>
					<view class="item3">
						Stay tuned for more benefits...
					</view>
				</view>

				<view class="title">
					How To Get EXP
				</view>
				<view class="exp">
					Just complete the gift card transaction !
				</view>
				<view class="exp viewUrl">
					<navigator url="./getEXP">View details ></navigator>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				currency_id:uni.getStorageSync('currency_id'),
				vipList:[],
				current:0,
				vip:{award_show:false,award_money:0,award_exchange:0},
				award_show:false,
			}
		},
		onLoad() {
			this.getVipList()
		},
		methods: {
			getVipList() {
				this.$post("/user/get_vip_list",{currency_id:this.currency_id}).then(res => {
					console.log(res)
					this.vipList = res.data.vip_list
					let _that = this
					this.vipList.forEach(function(item,index){
						if(item.selected == 1)
						 {
							 _that.vip = _that.vipList[index]
							 _that.current = index
						 }
						 
					})
				})
			},
			onSwiperChange(e) {
			      this.current = e.detail.current;
				  this.vip = this.vipList[this.current]
			    }
		}
	}
</script>

<style lang="scss" scoped>
	page {
		background-color: #EDF0FF;
	}

	.container {
		padding: 30rpx;
		position: relative;

		.bg {
			position: absolute;
			left: 0%;
			top: 0%;
			width: 100%;
		}

		.content {
			position: relative;
		}
	}

	.banner {
		height: 254rpx;
		position: relative;

		.card {
			position: absolute;
			left: 0%;
			top: 0;
			width: 100%;
			height: 100%;
			padding: 50rpx 40rpx;
			color: #fff;
			display: flex;
			flex-direction: column;
			justify-content: space-between;

			.name {
				display: flex;
				align-items: center;
				font-weight: bold;
				font-size: 44rpx;

				image {
					width: 49rpx;
					height: 42rpx;
					margin-right: 8rpx;
				}
				.currentGrade{
					font-size: 24rpx;
					position: absolute;
					right: 30rpx;
					opacity: 0.6;
				}
			}

			.tips {
				opacity: 0.6;
				font-size: 24rpx;
				text-align: right;
			}
		}
	}

	.title {
		font-size: 32rpx;
		font-weight: bold;
		margin: 40rpx 0;
	}

	.Benefits {
		.tips{
			color: #ff4e1a;
			font-weight: 700;
			text-align: center;
			font-size: 36rpx;
		}
		.item1 {
			background: #FFFFFF;
			border-radius: 22rpx;
			border: 1px solid #FF602D;
			font-size: 32rpx;
			text-align: center;
			padding: 20rpx 0;

			text {
				color: #FF602D;
				font-size: 100rpx;
				margin-left: 30rpx;
			}
		}

		.item2 {
			background: #FFFFFF;
			border-radius: 91rpx 24rpx 24rpx 24rpx;
			border: 1px solid #54E7DA;
			text-align: center;
			padding: 0 60rpx;
			margin-top: 24rpx;

			.Increase {
				width: 460rpx;
				height: 45rpx;
				background: #64D7DA;
				border-radius: 0rpx 0rpx 15rpx 15rpx;
				margin: 0 auto;
				font-size: 24rpx;
				display: flex;
				align-items: center;
				justify-content: center;

				image {
					width: 41rpx;
					margin-right: 20rpx;
					height: 34rpx;
				}
			}

			.transaction {
				font-size: 30rpx;
				font-weight: bold;
				padding: 30rpx 0;
			}

			.num {
				font-size: 48rpx;

				text {
					font-size: 100rpx;
				}
			}

			.tips {
				font-size: 24rpx;
				color: #54E7DA;
				text-align: left;
				padding: 30rpx 0;
			}
		}

		.item3 {
			font-size: 24rpx;
			font-weight: bold;
			color: #999;
			text-align: center;
			padding: 40rpx 0;
			border-bottom: 2rpx solid #DBDCE1;
		}
	}

	.exp {
		text-align: center;
		margin-top: 60rpx;
		font-size: 28rpx;
	}
	.viewUrl{
		color: #ff4e1a;
	}
</style>